#include<iostream>
#include<algorithm>
using namespace std;
const int N=1e3+10;
int x[N];
int n;
int ans;
void dfs(int pos,int sum,int ji)
{
	
	for(int i=pos;i<=n;i++){
		sum+=x[i];
		ji*=x[i];
		if(sum>ji){
			ans++;
			dfs(i+1,sum,ji);
		}
		else if(x[i]==1) dfs(i+1,sum,ji);
		else break;
		sum-=x[i];
		ji/=x[i];
		while(i<=n&&x[i]==x[i+1])i++;
	}
}
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i];
	sort(x+1,x+n+1);
	dfs(1,0,1);
	cout<<ans<<endl;
	return 0;
}
